#include<iostream>
#include<string>
#include<cstring>
using namespace std;
const int N = 2e5 + 10;
int arr[N];
int b[N];
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		for (int i = 0; i < n - 1; i++)cin >> b[i];
		for (int i = 0; i < n; i++) {
			if (!i)arr[0] = b[0];
			else if (i == n - 1) {
				arr[i] = b[i - 1];
			}
			else {
				arr[i] = min(b[i], b[i - 1]);
			}
		}
		for (int i = 0; i < n; i++) {
			cout << arr[i] << " ";
		}
		cout << endl;
	}
	return 0;
}



